<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>03-$emit的用法</title>
</head>
<body>
  <!-- 01触发当前实例上的事件,附加参数都会传给监听器回调 -->
  <div id="app1">
    <welcome-button v-on:welcome='sayHi'></welcome-button>
  </div>
  
</body>
<script src="./vue1111.js"></script>
<script>
  
Vue.component('welcome-button',{
  template:`<button @click="$emit('welcome')">点击欢迎</button>`
})

new Vue({
  el:'#app1',
  methods:{
    sayHi(){
      alert('hi!')
    }
  }
});
</script>
</html>